Hello everyone, I am working on my first DXL script for DOORS. I do have some small background in other languages, but I was given an assignment at work with DXL and I need some help getting started on this code. |
Re: DXL Script - Emails Employee when a Module is updated. First, you'll need to decide what kind of script it will be, On-Demand or Triggering as the Admin makes the changes. 2nd, you need to decide if the current Client will be sending email directly through Outlook, or if you will attempt to configure DOORS to use Email and then make DXL calls to send the email. I would be very tempted to make it an On-Demand script scheduled to run batch at 12:01am, which opens that module, finds all changes made yesterday, and goes from there. This script can find all Object's whose Last Modified Date was yesterday, extract the user, and place all the changes into a Skip list KEY of username. Then plow through the Skip, convert name to email, and go from there. Another reasonable On-Demand script would be for the Admin, who after making a change, would push a button, and the info of the current Object is sent to the target user. A trigger firing script will need to decide exactly which "event" will trigger the program. I doubt your users want a separate Email every time any change is made; so if the Admin changes THIS to THAT and then correct it to THEN, the user would get 2 emails. I would probably make it a pre-close-module trigger looking for History changes made during the current Session. Convert those to Objects and proceed as above. As for the send part, search for "fEmail_Outlook_CreateMail" in these forums for a rather complicated interface for DOORS to send email through Outlook. I'm sure there is a better way but that is what I came up with. I don't recall how to configure DOORS to send emails, but I suspect that method is better (you call "sendEmailNotification()") since its probably application independant and communicates directly with the Email server. -Louie |
Re: DXL Script - Emails Employee when a Module is updated. llandale - Wed Apr 18 13:50:10 EDT 2012 > > I would be very tempted to make it an On-Demand script scheduled to run batch at 12:01am, which opens that module, finds all changes made yesterday, and goes from there. This script can find all Object's whose Last Modified Date was yesterday, extract the user, and place all the changes into a Skip list KEY of username. Then plow through the Skip, convert name to email, and go from there. > -Louie Lets start with this. This is exactly what I want. So I want to make a skip list and search through the entire module to find an updated object with a corresponding name. Then I want to convert it to an email address. I have been looking through some info on these boards, but if you have some first hand guidance I would be more than appreciative. Thanks for your help Matt |
Re: DXL Script - Emails Employee when a Module is updated. m.sprague - Fri Apr 20 15:12:00 EDT 2012 Let me think outloud.
Skip g_skpUsers // KEY: 'string' NameUser; DATA: embedded 'Skip' skpChanges
// embedded skpChanges: KEY: 'int' sequencer; DATA: 'string' blurb about each Object change of interest to this User
int g_Sequencer = 0
for each item in Project
if its not a formal module then continue
if it wasn't changed yesterday then continue // actually, since the last time this script ran
Open Module read
for each Object
if it wasn't changed yesterday continue
bufBlurb = Identifier and Paragraph Number and Last Modified By and On
for each History in the Object
if History wasn't yesterday then continue
if I don't care about this History then continue
bufBlurb += add short summary of this History change including attrname
end
for each NameUser who cares about this object
if this NameUser is not yet in g_skpUsers
skpChanges = create()
put(g_skpUsers, NameUser, skpChanges)
put(skpChanges, g_Sequencer++, stringOf(bufBlurb))
end
end
close(mod)
end
for skpChanges in g_skpUsers do
NameUser = (string key g_skpUsers)
if not existsUser(NameUser) then no such user
usr = find(NameUser)
Email = usr.email
bufEmail = ""
for each Blurb in skpChanges
bufEmail += Blurb
Create/Send email to this user
end
|